package com.neusoft.resturant.service.impl;


import com.neusoft.resturant.entity.ResReview;
import com.neusoft.resturant.mapper.ResReviewMapper;
import com.neusoft.resturant.service.IResReviewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 评论Service业务层处理
 * 
 * @author sl
 * @date 2023-12-20
 */
@Service
public class ResReviewServiceImpl implements IResReviewService
{
    @Autowired
    private ResReviewMapper resReviewMapper;

    /**
     * 查询评论
     * 
     * @param id 评论主键
     * @return 评论
     */
    @Override
    public ResReview selectResReviewById(Long id)
    {
        return resReviewMapper.selectResReviewById(id);
    }

    /**
     * 查询评论列表
     * 
     * @param resReview 评论
     * @return 评论
     */
    @Override
    public List<ResReview> selectResReviewList(ResReview resReview)
    {
        return resReviewMapper.selectResReviewList(resReview);
    }

    /**
     * 新增评论
     * 
     * @param resReview 评论
     * @return 结果
     */
    @Override
    public int insertResReview(ResReview resReview)
    {
        resReview.setCreateTime(new Date());
        return resReviewMapper.insertResReview(resReview);
    }

    /**
     * 修改评论
     * 
     * @param resReview 评论
     * @return 结果
     */
    @Override
    public int updateResReview(ResReview resReview)
    {
        resReview.setUpdateTime(new Date());
        return resReviewMapper.updateResReview(resReview);
    }

    /**
     * 批量删除评论
     * 
     * @param ids 需要删除的评论主键
     * @return 结果
     */
    @Override
    public int deleteResReviewByIds(Long[] ids)
    {
        return resReviewMapper.deleteResReviewByIds(ids);
    }

    /**
     * 删除评论信息
     * 
     * @param id 评论主键
     * @return 结果
     */
    @Override
    public int deleteResReviewById(Long id)
    {
        return resReviewMapper.deleteResReviewById(id);
    }
}
